<ion-view view-title="分区领单">
  <ion-nav-buttons side="right">
    <button class="button button-clear button-positive" ng-click="barscanReceive()">扫码</button>
  </ion-nav-buttons>
  <ion-content>
      <ion-refresher on-refresh="getOrdersArray()"
                     pulling-text="下拉刷新..."
                     refreshing-text="拼命加载中..."
                     refreshing-icon="ion-loading-b">

      </ion-refresher>
      <div class="item" >
          <h2 class="assertive">您的区域内共有{{ordersCount}}条订单未领取,{{rOrdersCount}}条未抢单</h2>
      </div>
      <div class="list card" ng-repeat="order in ordersArray" href="#">
        <div class="item">
          <h2>{{order.get('areaId') | area}}区-<span style="color: red;">{{order.get('type') | orderTypeName}}</span>{{order.get('orderid')}}</h2>
        </div>
        <div class="item item-body">
          <p ng-if="(order.get('type') === 9)">
            商家名称：{{order.get('sellerName')}}--{{order.get('storeName')}}
          </p>
          <p>
            订单状态：{{order.get('status') | orderState}}
          </p>
          <p>
            派送地址：{{order.get('address').address}}
          </p>
          <p>
            收件人：{{order.get('address').name}} <a href="tel:{{order.get('address').phone}}">{{order.get('address').phone}}</a>
          </p>
          <p>
            支付方式：{{order.get('payway')}}
          </p>
            <p>
                订单备注：{{order.get('remark')}}
            </p>
          <p>
            下单时间：{{order.createdAt | date:'yyyy-MM-dd HH:mm'}}
          </p>
            <p>
                审核时间：{{(order.get('approvaldate') ||o.get('paytime')) | deltaDate}} 分钟前
            </p>
            <button ng-if="(order.get('messioned') !== true)" ng-disabled="order.get('messioned')===true" class="button button-block button-assertive" ng-click="rush(event,order,$index)">我抢</button>
            <button ng-if="(order.get('messioned') === true)" class="button button-block button-balanced" >已抢</button>
        </div>
      </div>
      <div ng-if="(ordersArray.length === 0)" class="card">
        <div class="item item-text-wrap">
          啥都没有~
        </div>
      </div>
      <!--<ion-infinite-scroll ng-if="hasMore" on-infinite="loadMore()" distance="1%" ></ion-infinite-scroll>-->
  </ion-content>
</ion-view>
